'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, middleware } = app;
  const jwtErr = middleware.jwtErr(app.config);
  router.post('/apis/manage/login', controller.login.index); // 登录
  router.get('/apis/manage/index', jwtErr, controller.home.index); // 首页
  router.get('/apis/manage/article', jwtErr, controller.article.index); // 文章列表
  router.post('/apis/manage/articleAdd', jwtErr, controller.article.add); // 添加文章

  router.post('/apis/common/upload', jwtErr, controller.common.upload);// 上传图片
  router.get('*', controller.error.index);
};